package Test00;

import java.io.File;
import java.io.IOException;
import java.util.Scanner;

public class Test05 {
    public static void main(String[] args) throws IOException {

        Scanner scan = new Scanner(System.in);
        while (true){//自造死循环
            System.out.println("请输入文件名");
            String name = scan.nextLine();
            File file1 = new File(name);
            if (file1.exists()){
                System.out.println("文件已存在，请重新输入");
            }else{
                file1.createNewFile();
                System.out.println("该文件已创建成功");
            }
        }
    }
}
